home *** CD-ROM | disk | FTP | other *** search
- //
- // MiscPickList.h -- Pick List
- // Written by Don Yacktman Copyright (c) 1994 by Don Yacktman.
- // Version 0.1. All rights reserved.
- //
- // This notice may not be removed from this source code.
- //
- // This object is included in the MiscKit by permission from the author
- // and its use is governed by the MiscKit license, found in the file
- // "LICENSE.rtf" in the MiscKit distribution. Please refer to that file
- // for a list of all applicable permissions and restrictions.
- //
-
- // This object will pop up a window with a list of possible selections.
- // If one is selected, it is entered into the associated "textPal".
- // If -addItem: or modifyItem: is sent, then a new key is taken from
- // the entryText and added to the list. This class requires the accompanying
- // "MiscPickList.nib" to be in your application's project for it to work.
-
- // Do NOT allocate these yourself; use the +findPickListNamed: method!
-
- #import <misckit/misckit.h>
-
- @interface MiscPickList : MiscNibController
- {
- MiscDictionary *itemList;
- List *sortedKeys;
- MiscString *listPath;
- MiscString *listName;
- BOOL changed, autoSave;
- id textPal; // connected up dynamically to the GUI
-
- // Things to connect to the GUI:
- id browser; // a Matrix of TextFields inside a ScrollView
- id entryText; // a TextField
- id modifyButton; // a Button
- id addButton; // a Button
- }
-
- + findPickListNamed:(MiscString *)aName; // use this to get picklists.
- + (MiscString *)pickListExtension;
- + (MiscString *)fileNameForPickListNamed:(MiscString *)aName;
-
-
- - init; // don't ever call init!
- - free;
- - initForListNamed:(MiscString *)aName;
- - loadItemList:(MiscString *)aPath name:(MiscString *)aName;
- - reloadItemList;
- - saveList;
- - saveListToPath:(MiscString *)aPath;
-
- - popUp:sender; // brings up the associated window.
- - popUpForTextPal:aTextField; // sets text pal and does pop up
- - doEntry:sender; // enters current selection into the textPal
- - finishEntry:sender; // above plus closes window
-
- - addItem:sender; // adds -stringValue of textPal as a key. (val==key)
- - modifyItem:sender; // changes the selected key and value pair
- - addItemToList:(MiscString *)anItem; // add a string as a key
- - addItemToList:(MiscString *)anItem value:(MiscString *)aValue;
- - removeItemFromList:(MiscString *)anItem;
- - (MiscDictionary *)itemList;
- - (BOOL)isDirty; // returns YES if needs to be saved.
- - (MiscString *)listPath;
- - (MiscString *)listName;
-
- // any action which alters the list will cause it to be saved if
- // autoSave is on. This is the default behavior.
- - (BOOL)autoSave;
- - setAutoSave:(BOOL)flag;
-
- - setBrowser:anObject;
- - browser;
- - setEntryText:anObject;
- - entryText;
- - setTextPal:anObject;
- - textPal;
-
- - (MiscString *)selectedKey;
- - selectKey:(MiscString *)aKey;
-
- @end
-